﻿@model GTAuto.DAL.Entities.GTAdCategory
@{
    ViewBag.Title = "CategoryEdit";
    Layout = "~/Views/Shared/_Layout.cshtml";
    List<string> err = ViewBag.Errs;
    SelectList TypeSel = ViewBag.gtMaincategories;
}
<h4 class="alert_info">
    @if (Model.Id > 0)
    {
        <div>
            Редактирование категории</div>
    }
    else
    {
  
        <div>
            Создание катеогрии</div>
    }
</h4>
@using (Html.BeginForm("CategoryEdit", "Ads", FormMethod.Post, new { @class = "jNice", enctype = "multipart/form-data" }))
{

    if (err != null && err.Count != 0)
    {

        foreach (var er in err)
        {

    <h4 class="alert_error">
        @er</h4>

        }
    }
    if (ViewBag.Succes != null)
    {
    <h4 class="alert_success">
        @ViewBag.Succes</h4>
    }

    
    @Html.Hidden("Id", Model.Id)
    <article class="module width_full">
        <header><h3>Данные о категории</h3></header>
        <div class="module_content">
            <fieldset>
                <label>Название</label>
                <input type="text" id="Name" name="Name" value="@Model.Name" />
            </fieldset>
            <fieldset>
                <label>Описание</label>
               <textarea rows="10" cols="1" name="Description" id="Description">@Model.Description</textarea>
            </fieldset>
    
             <fieldset>
                <label>Тип значения</label>
                @Html.DropDownList("ParentId", TypeSel)
            </fieldset>
            <div class="clear"></div>
        </div>
        <footer>
            <div class="submit_link">
                <input type="submit" value="Сохранить" class="alt_btn">
            </div>
        </footer>
    </article>
}
<!-- end of post new article -->
<div class="spacer">
</div>
